/* ========================================
   CSS GLOBAL - SISTEMA EVA POWER PAGES
   ======================================== */

/* Reset Base */
html, body {
  height: 100%;
  overflow: hidden;
}

/* Container Principal */
.page-container {
  position: absolute;
  top: 0;
  left: 220px;
  right: 0;
  bottom: 0;
  padding: 40px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Cabeçalho Fixo */
.fixed-header {
  background-color: #ffffff;
  margin-bottom: 20px;
  width: 100%;
}

.table-title {
  font-size: 23px;
  font-weight: 600;
  color: #000680;
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #0088ff;
}

/* Container da Tabela */
.custom-table-container {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  width: 100%;
  min-height: 0;
}

/* Barra de Filtros e Ações */
.filters-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: wrap;
  gap: 15px;
}

/* Container de Filtros */
.filters-container {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  flex-wrap: wrap;
  flex: 1;
}

/* Botão Toggle de Filtros (Mobile/Tablet) */
.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #0088ff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
}

.filter-toggle-btn:hover {
  background-color: #006dd1;
}

/* Grupo de Filtro */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Label do Filtro */
.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #000680;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Select do Filtro */
.filter-select {
  min-width: 180px;
  padding: 9px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  color: #000680;
  background-color: white;
  transition: all 0.3s ease;
  cursor: pointer;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

.filter-select:hover {
  border-color: #0088ff;
}

.filter-select:focus {
  outline: none;
  border-color: #0088ff;
  box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
}

/* Container de Busca */
.search-input-container {
  position: relative;
  min-width: 200px;
}

/* Ícone de Busca */
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  pointer-events: none;
}

/* Input de Busca */
.search-input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  color: #000680;
  transition: all 0.3s ease;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

.search-input:hover {
  border-color: #0088ff;
}

.search-input:focus {
  outline: none;
  border-color: #0088ff;
  box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
}

.search-input::placeholder {
  color: #999;
}

/* Ações de Filtro */
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Botão Aplicar Filtros */
.btn-apply-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #0088ff;
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

.btn-apply-filters:hover {
  background-color: #006dd1;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 136, 255, 0.3);
}

/* Botão Limpar Filtros */
.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: transparent;
  color: #666;
  border: 2px solid #e0e0e0;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

.btn-clear-filters:hover {
  border-color: #999;
  color: #333;
  background-color: #f8f8f8;
}

/* Botão Download Excel */
.btn-download-excel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #0088ff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

.btn-download-excel:hover:not(:disabled) {
  background-color: #2bd683;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(33, 115, 70, 0.3);
}

.btn-download-excel:active:not(:disabled) {
  transform: translateY(0);
}

.btn-download-excel:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-download-excel svg {
  width: 18px;
  height: 18px;
}

/* Spinner para Loading */
.spinner-excel {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Notificações */
.excel-notification {
  position: fixed;
  top: 20px;
  right: -400px;
  padding: 15px 20px;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  font-size: 14px;
  z-index: 9999;
  transition: right 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.excel-notification.show {
  right: 20px;
}

.excel-notification.success {
  background-color: #28a745;
}

.excel-notification.error {
  background-color: #dc3545;
}

/* Tabela - Cabeçalho Fixo */
.custom-table-header {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  flex-shrink: 0;
}

.custom-table-header thead th {
  color: #000680;
  font-weight: 500;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
  position: relative;
}

/* Cabeçalhos Ordenáveis */
.custom-table-header th.sortable {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  position: relative;
}

.custom-table-header th.sortable:hover {
  background-color: #f0f7ff;
  transform: translateY(-1px);
}

.custom-table-header th.sortable:active {
  transform: translateY(0);
}

/* Ícones de Ordenação */
.sort-icon {
  display: inline-block;
  margin-left: 5px;
  color: #0088ff;
  font-size: 13px;
  vertical-align: middle;
  font-weight: normal;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.custom-table-header th.sortable:hover .sort-icon {
  opacity: 1;
}

/* Coluna Ativa com Ordenação */
.custom-table-header th.sortable.active-sort {
  background-color: #e8f4ff;
  font-weight: 600;
}

.custom-table-header th.sortable.active-sort .sort-icon {
  opacity: 1;
  color: #000680;
}

/* Container de Scroll para o Corpo */
.table-body-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 0;
}

/* Tabela - Corpo */
.custom-table-body {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}

.custom-table-body tbody tr {
  border-bottom: 1px solid #f0f0f0;
  background-color: #ffffff;
}

.custom-table-body tbody tr:hover {
  background-color: #e8f4ff;
  transition: background-color 0.2s ease;
}

.custom-table-body tbody td {
  color: #000680;
  padding: 16px;
  font-size: 13px;
  vertical-align: middle;
}

/* Badge de Companhia Aérea */
.cia-badge {
  display: inline-block;
  background-color: #000680;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* Células de Aeroporto e Data */
.airport-date-cell {
  padding: 12px 16px;
}

.airport-date-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.airport-section {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}

.date-time-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
}

.airport-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.airport-code {
  display: inline-block;
  font-weight: 700;
  color: #000680;
  font-size: 14px;
}

.city-name {
  display: block;
  font-size: 10px;
  color: #666;
  font-weight: 400;
  margin-top: 2px;
}

/* Código Localizador */
.localizador-code {
  display: inline-block;
  background-color: #e6f7e6;
  color: #008800;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 500;
}

/* Previsão de Pouso */
.previsao-pouso {
  display: block;
  font-size: 10px;
  color: #0088ff;
  font-weight: 600;
  margin-top: 2px;
  padding: 2px 0px;
  text-align: left;
}

/* Células de Data */
.date-cell {
  white-space: normal;
  line-height: 1.3;
}

.date-part {
  display: block;
  font-weight: 600;
  color: #000680;
  font-size: 13px;
  margin-bottom: 2px;
}

.time-part {
  display: block;
  color: #666;
  font-size: 12px;
  font-weight: 500;
}

/* Badges de Status */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  background-color: #e0e0e0;
  color: #333;
}

.status-ok {
  background-color: #d4edda;
  color: #155724;
}

.status-alterado {
  background-color: #fff3cd;
  color: #856404;
}

.status-cancelado {
  background-color: #f8d7da;
  color: #721c24;
}

/* Badge de Status do Voo */
.flight-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  background-color: #e8f4ff;
  color: #000680;
  white-space: nowrap;
}

/* Scrollbar Customizada */
.table-body-scroll::-webkit-scrollbar {
  width: 10px;
}

.table-body-scroll::-webkit-scrollbar-track {
  background: rgba(241, 241, 241, 0.1);
  border-radius: 10px;
}

.table-body-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 136, 255, 0.1);
  border-radius: 10px;
}

.table-body-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(190, 87, 250, 0.1);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #000680;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-state p {
  color: #666;
  font-size: 14px;
}

.empty-state-icon {
  font-size: 48px;
  color: #0088ff;
  margin-bottom: 16px;
}

/* Classes Utilitárias para Responsividade */
.hide-mobile {
  display: table-cell;
}

.hide-tablet {
  display: table-cell;
}

/* ========================================
   MEDIA QUERIES - RESPONSIVIDADE
   ======================================== */

/* Telas Grandes */
@media screen and (min-width: 1920px) {
  .page-container {
    padding: 40px 80px;
  }
}

/* Tablet */
@media screen and (max-width: 1024px) {
  .page-container {
    padding: 30px 40px;
  }
  
  .fixed-header {
    text-align: right;
    padding-right: 20px;
  }

  .filter-toggle-btn {
    display: inline-flex !important;
  }

  .filters-container {
    flex-wrap: wrap;
    width: 100%;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
  }

  .filter-group {
    flex: 1;
    min-width: 150px;
  }

  .hide-tablet {
    display: none !important;
  }

  .custom-table-container {
    padding: 15px;
  }
}

/* Mobile */
@media screen and (max-width: 768px) {
  .page-container {
    padding: 20px;
    left: 0;
  }
  
  .fixed-header {
    text-align: right;
    padding-right: 10px;
    margin-bottom: 15px;
  }
  
  .table-title {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .custom-table-container {
    padding: 15px;
  }

  .filters-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .filter-toggle-btn {
    display: inline-flex !important;
    width: auto;
    align-self: flex-start;
  }
  
  .filters-container {
    display: none;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
  }
  
  .filters-container.active {
    display: flex;
  }

  .filter-group {
    width: 100%;
  }

  .filter-select,
  .search-input-container {
    width: 100%;
    min-width: 100%;
  }

  .filter-actions {
    width: 100%;
    justify-content: stretch;
    flex-direction: row;
  }

  .btn-apply-filters,
  .btn-clear-filters {
    flex: 1;
  }

  .btn-download-excel {
    width: 100%;
    justify-content: center;
  }

  .btn-download-excel span {
    display: inline;
  }

  .btn-download-excel svg {
    margin: 0;
  }

  .hide-mobile {
    display: none !important;
  }

  .custom-table-header th,
  .custom-table-body td {
    padding: 12px 8px;
    font-size: 13px;
  }

  .airport-date-info {
    flex-direction: column;
    gap: 5px;
  }
  
  .date-time-section {
    align-items: flex-start;
  }

  .date-part {
    font-size: 13px;
  }

  .time-part {
    font-size: 12px;
  }

  .airport-code {
    font-size: 14px;
  }

  .excel-notification {
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* Mobile Muito Pequeno */
@media screen and (max-width: 480px) {
  .page-container {
    padding: 0 15px;
  }

  .table-title {
    font-size: 20px;
  }

  .custom-table-header th,
  .custom-table-body td {
    padding: 10px 5px;
    font-size: 12px;
  }

  .date-part {
    font-size: 12px;
  }

  .time-part {
    font-size: 11px;
  }

  .filter-actions {
    flex-direction: column;
    gap: 8px;
  }

  .btn-apply-filters,
  .btn-clear-filters {
    width: 100%;
  }
}